<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <link rel="stylesheet" href="./lib/layui/css/layui.css" />
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <script th:inline="none">
       layui.use(["form","layer"],function(){
            var form=layui.form;
            var layer=layui.layer;
            form.on("submit(updatequs)",function(data){
                $.ajax({
                    url:"updatequs",
                    data:data.field,
                    dataType:"json",
                    type:"post",
                    success:function(dataJson){
                        if(dataJson.code==200){
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.location.reload();//刷新父页面，注意一定要在关闭当前iframe层之前执行刷新
                            parent.layer.close(index); //再执行关闭
                        }else{
                            layer.msg(dataJson.msg);
                        }
                    }
                })
                return false;
            })
        })
    </script>
</head>
<body>
<form class="layui-form" action="">
    <input type="hidden" name="id" th:value="${qustion.id}" />
    <input type="hidden" name="teacherid" th:value="${session.loginteacher.id}" />
    <div class="layui-form-item">
        <label class="layui-form-label">题目</label>
        <div class="layui-input-block">
            <input type="text" name="content" th:value="${qustion.content}"required  lay-verify="required" placeholder="请输入题目" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选项1</label>
        <div class="layui-input-block">
            <input type="text" name="con1" th:value="${qustion.con1}" required  lay-verify="required" placeholder="请输入选项" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选项2</label>
        <div class="layui-input-block">
            <input type="text" name="con2" th:value="${qustion.con2}" required  lay-verify="required" placeholder="请输入选项" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选项3</label>
        <div class="layui-input-block">
            <input type="text" name="con3" th:value="${qustion.con3}" required  lay-verify="required" placeholder="请输入选项" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选项4</label>
        <div class="layui-input-block">
            <input type="text" name="con4"th:value="${qustion.con4}" required  lay-verify="required" placeholder="请输入选项" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">答案</label>
        <div class="layui-input-block" th:if="${qustion.answer}==1">
            <input type="radio" name="answer" value="1" title="选项1"checked>
            <input type="radio" name="answer" value="2" title="选项2" >
            <input type="radio" name="answer" value="3" title="选项3" >
            <input type="radio" name="answer" value="4" title="选项4" >
        </div>
        <div class="layui-input-block" th:if="${qustion.answer}==2">
            <input type="radio" name="answer" value="1" title="选项1">
            <input type="radio" name="answer" value="2" title="选项2" checked>
            <input type="radio" name="answer" value="3" title="选项3" >
            <input type="radio" name="answer" value="4" title="选项4" >
        </div>
        <div class="layui-input-block" th:if="${qustion.answer}==3">
            <input type="radio" name="answer" value="1" title="选项1">
            <input type="radio" name="answer" value="2" title="选项2" >
            <input type="radio" name="answer" value="3" title="选项3" checked>
            <input type="radio" name="answer" value="4" title="选项4" >
        </div>
        <div class="layui-input-block" th:if="${qustion.answer}==4">
            <input type="radio" name="answer" value="1" title="选项1">
            <input type="radio" name="answer" value="2" title="选项2" >
            <input type="radio" name="answer" value="3" title="选项3" >
            <input type="radio" name="answer" value="4" title="选项4" checked>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="updatequs">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</body>
</html>